home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 12: Textmags & Docs / nf_archive_12.iso / MAGS / SOURCES / ATARI_SRC.ZIP / atari source / AHDI / CHNLTST / LOOPTST.C < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-09  |  1.9 KB  |  112 lines

  1. #include "sparrow.h"
  2. #include <osbind.h>
  3.  
  4. /* This prgram sets the SDMA and RASCAL into a state that causes them
  5. to copy the middle part of the screen to the top
  6. 1) Find the location of the screen, save in vidbase
  7. 2) Set SDMA record begin registers to vid_base
  8. 3) Set SDMA record end registers to vid_base + 0x1000
  9. 4) Set SDMA playback registers to vidbase + 0x2000
  10. 5) Set SDMA playback registers to vidbase + 0x3000
  11. 6) Set the MicroWire stuff to mask=0xFFE0 data=0xB920
  12. 7) turn on SDMA playback and record with looping
  13. 8) exit
  14. */
  15.  
  16. unsigned int bytehm,bytelm,bytell;
  17. long vidbase;
  18.  
  19. doit()
  20. {
  21.  
  22. bytehm=*(char *)0xFF8201L;
  23. bytelm=*(char *)0xFF8203L;
  24. bytell=*(char *)0xFF820dL;
  25.  
  26. bytehm=bytehm&0xFF;
  27. bytelm=bytelm&0xFF;
  28. bytell=bytell&0xFF;
  29. vidbase=((long)bytehm<<16)+(bytelm<<8)+(bytell);
  30.  
  31. *s_dma_ctl=0x80;
  32.  
  33. *f_b_um=vidbase>>16;
  34. *f_b_lm=(vidbase>>8)&(0xFFL);
  35. *f_b_ll=vidbase&0xFFL;
  36.  
  37. vidbase+=0x2000L;
  38.  
  39. *f_e_um=vidbase>>16;
  40. *f_e_lm=(vidbase>>8)&(0xFFL);
  41. *f_e_ll=vidbase&0xFFL;
  42.  
  43. vidbase+=0x0L;
  44.  
  45. *s_dma_ctl=0x00;
  46.  
  47. *f_b_um=vidbase>>16;
  48. *f_b_lm=(vidbase>>8)&(0xFFL);
  49. *f_b_ll=vidbase&0xFFL;
  50.  
  51. vidbase+=0x2000L;
  52.  
  53. *f_e_um=vidbase>>16;
  54. *f_e_lm=(vidbase>>8)&(0xFFL);
  55. *f_e_ll=vidbase&0xFFL;
  56.  
  57. *uwire_mask=0xFFE0;
  58. *uwire_data=0xB920;
  59.  
  60. *s_mode_ctl=0x43;
  61.  
  62. *s_dma_ctl=0x30;
  63. *s_dma_ctl=0x33;
  64. }
  65.  
  66. disable_loop()
  67. {
  68. *s_dma_ctl=0x0;
  69. }
  70.  
  71. enable_loop()
  72. {
  73. *s_dma_ctl=0x30;
  74. *s_dma_ctl=0x33;
  75. }
  76.  
  77. inner_loop()
  78. {
  79. *uwire_mask=0xFFE0;
  80. *uwire_data=0xB920;
  81. }
  82.  
  83. monitor_sound()
  84. {
  85. *uwire_mask=0xFFE0;
  86. *uwire_data=0xB940;
  87. }
  88.  
  89. outer_loop()
  90. {
  91. *uwire_mask=0xFFE0;
  92. *uwire_data=0xB960;
  93. }
  94.  
  95. main()
  96. {
  97. int key;
  98.  
  99. Supexec(doit);
  100. for (;;)
  101.     {
  102.     while (Bconstat(2)!=-1);
  103.     key=Bconin(2);
  104.     if (key=='r') Supexec(inner_loop);
  105.     if (key=='c') Supexec(outer_loop);
  106.     if (key=='s') Supexec(monitor_sound);
  107.     if (key=='d') Supexec(disable_loop);
  108.     if (key=='e') Supexec(enable_loop);
  109.     if (key==' ') break;
  110.     }
  111. }
  112.